//
//  HMPasswordController.m
//  仿真开发
//
//  Created by LZH on 2017/3/25.
//  Copyright © 2017年 B.HOPE. All rights reserved.
//

#import "HMPasswordController.h"
#import "HMbounceTool.h"
@interface HMPasswordController ()


/** 当前用户密码 */
@property (nonatomic,weak) NSString *currentPassword;
@property (weak, nonatomic) IBOutlet UITextField *oldPassWord;
@property (weak, nonatomic) IBOutlet UITextField *updatePassword;


@end

@implementation HMPasswordController
- (void)viewDidLoad {
    [super viewDidLoad];
    
   
    _currentPassword = @"12345";
    
    //输入完毕隐藏键盘
    UITapGestureRecognizer *tapGr = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(viewTapped:)];
    tapGr.cancelsTouchesInView = NO;
    [self.view addGestureRecognizer:tapGr];
    
}

- (IBAction)updatePassword:(UIButton *)sender {
    
    //获取用户输入的密码
    NSString *oldPassword =_oldPassWord.text;
    //NSString *newPassword = _updatePassword.text;
    
   
    if(![_currentPassword isEqualToString:oldPassword]){
        
        [HMbounceTool CKLShowSVErrorTitle:@"旧密码与原密码不匹配" andTime:1];
        
    }else{
        
      [HMbounceTool CKLShowSVSuccessTitle:@"密码修改成功" andTime:1];
        
        
    }
}


//手势的实现
-(void)viewTapped:(UITapGestureRecognizer*)tapGr{
    [self.oldPassWord resignFirstResponder];
    [self.updatePassword resignFirstResponder];
}



@end
